const mongoose = require('mongoose')
//自动创建索引
// mongoose.set("useNewUrlParser", true);
// mongoose.set("useUnifiedTopology", true);
// mongoose.set("useFindAndModify", false)
// mongoose.set("useCreateIndex", true)
//连接数据库
mongoose.connect(`mongodb://${process.env.DB_HOST}:27017/${process.env.DB_NAME}`).then(()=>{
  console.log('数据库链接成功');
}).catch(err=>{
  console.log(err,'数据库链接失败');
})
mongoose.Promise = global.Promise;
module.exports = mongoose;